
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh_CN">
  <head>
    <meta charset="utf-8" />
    <title>结构化标记处理工具 &#8212; Python 3.7.8 文档</title>
    <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script type="text/javascript" src="../_static/translations.js"></script>
    
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    
    <link rel="search" type="application/opensearchdescription+xml"
          title="在 Python 3.7.8 文档 中搜索"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="关于这些文档" href="../about.html" />
    <link rel="index" title="索引" href="../genindex.html" />
    <link rel="search" title="搜索" href="../search.html" />
    <link rel="copyright" title="版权所有" href="../copyright.html" />
    <link rel="next" title="html --- 超文本标记语言支持" href="html.html" />
    <link rel="prev" title="uu --- 对 uuencode 文件进行编码与解码" href="uu.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <link rel="canonical" href="https://docs.python.org/3/library/markup.html" />
    
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    
    
    
    
    <style>
      @media only screen {
        table.full-width-table {
            width: 100%;
        }
      }
    </style>
 

  </head><body>
  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>导航</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="总目录"
             accesskey="I">索引</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python 模块索引"
             >模块</a> |</li>
        <li class="right" >
          <a href="html.html" title="html --- 超文本标记语言支持"
             accesskey="N">下一页</a> |</li>
        <li class="right" >
          <a href="uu.html" title="uu --- 对 uuencode 文件进行编码与解码"
             accesskey="P">上一页</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <a href="../index.html">3.7.8 Documentation</a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Python 标准库</a> &#187;</li>
    <li class="right">
        

    <div class="inline-search" style="display: none" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="快速搜索" type="text" name="q" />
          <input type="submit" value="转向" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    <script type="text/javascript">$('.inline-search').show(0);</script>
         |
    </li>

      </ul>
    </div>    

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="structured-markup-processing-tools">
<span id="markup"></span><h1>结构化标记处理工具<a class="headerlink" href="#structured-markup-processing-tools" title="永久链接至标题">¶</a></h1>
<p>Python 支持各种模块，以处理各种形式的结构化数据标记。 这包括使用标准通用标记语言（SGML）和超文本标记语言（HTML）的模块，以及使用可扩展标记语言（XML）的几个接口。</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="html.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">html</span></code> --- 超文本标记语言支持</a></li>
<li class="toctree-l1"><a class="reference internal" href="html.parser.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">html.parser</span></code> --- 简单的 HTML 和 XHTML 解析器</a><ul>
<li class="toctree-l2"><a class="reference internal" href="html.parser.html#example-html-parser-application">HTML 解析器的示例程序</a></li>
<li class="toctree-l2"><a class="reference internal" href="html.parser.html#htmlparser-methods"><code class="xref py py-class docutils literal notranslate"><span class="pre">HTMLParser</span></code> 方法</a></li>
<li class="toctree-l2"><a class="reference internal" href="html.parser.html#examples">例子</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="html.entities.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">html.entities</span></code> --- HTML 一般实体的定义</a></li>
<li class="toctree-l1"><a class="reference internal" href="xml.html">XML处理模块</a><ul>
<li class="toctree-l2"><a class="reference internal" href="xml.html#xml-vulnerabilities">XML 漏洞</a></li>
<li class="toctree-l2"><a class="reference internal" href="xml.html#the-defusedxml-and-defusedexpat-packages"><code class="xref py py-mod docutils literal notranslate"><span class="pre">defusedxml</span></code> 和 <code class="xref py py-mod docutils literal notranslate"><span class="pre">defusedexpat</span></code> 软件包</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="xml.etree.elementtree.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.etree.ElementTree</span></code> ---  ElementTree XML API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="xml.etree.elementtree.html#tutorial">教程</a><ul>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#xml-tree-and-elements">XML树和元素</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#parsing-xml">解析XML</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#pull-api-for-non-blocking-parsing">Pull API进行非阻塞解析</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#finding-interesting-elements">寻找有趣的元素</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#modifying-an-xml-file">修改XML文件</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#building-xml-documents">构建XML文档</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#parsing-xml-with-namespaces">使用命名空间解析XML</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#additional-resources">其他资源</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="xml.etree.elementtree.html#xpath-support">XPath支持</a><ul>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#example">示例</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#supported-xpath-syntax">支持的XPath语法</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="xml.etree.elementtree.html#reference">参考</a><ul>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#functions">函数</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="xml.etree.elementtree.html#xinclude-support">XInclude 支持</a><ul>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#id3">示例</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="xml.etree.elementtree.html#id4">参考</a><ul>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#elementinclude-functions">函数</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#element-objects">元素对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#elementtree-objects">ElementTree 对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#qname-objects">QName Objects</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#treebuilder-objects">TreeBuilder Objects</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#xmlparser-objects">XMLParser对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#xmlpullparser-objects">XMLPullParser对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.etree.elementtree.html#exceptions">异常</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="xml.dom.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.dom</span></code> --- The Document Object Model API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="xml.dom.html#module-contents">模块内容</a></li>
<li class="toctree-l2"><a class="reference internal" href="xml.dom.html#objects-in-the-dom">Objects in the DOM</a><ul>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#domimplementation-objects">DOMImplementation Objects</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#node-objects">节点对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#nodelist-objects">节点列表对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#documenttype-objects">文档类型对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#document-objects">文档对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#element-objects">元素对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#attr-objects">Attr 对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#namednodemap-objects">NamedNodeMap 对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#comment-objects">注释对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#text-and-cdatasection-objects">Text 和 CDATASection 对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#processinginstruction-objects">ProcessingInstruction 对象</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#exceptions">异常</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="xml.dom.html#conformance">一致性</a><ul>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#type-mapping">类型映射</a></li>
<li class="toctree-l3"><a class="reference internal" href="xml.dom.html#accessor-methods">Accessor Methods</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="xml.dom.minidom.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.dom.minidom</span></code> --- Minimal DOM implementation</a><ul>
<li class="toctree-l2"><a class="reference internal" href="xml.dom.minidom.html#dom-objects">DOM Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="xml.dom.minidom.html#dom-example">DOM Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="xml.dom.minidom.html#minidom-and-the-dom-standard">minidom and the DOM standard</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="xml.dom.pulldom.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.dom.pulldom</span></code> --- Support for building partial DOM trees</a><ul>
<li class="toctree-l2"><a class="reference internal" href="xml.dom.pulldom.html#domeventstream-objects">DOMEventStream Objects</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="xml.sax.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.sax</span></code> --- Support for SAX2 parsers</a><ul>
<li class="toctree-l2"><a class="reference internal" href="xml.sax.html#saxexception-objects">SAXException Objects</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="xml.sax.handler.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.sax.handler</span></code> --- Base classes for SAX handlers</a><ul>
<li class="toctree-l2"><a class="reference internal" href="xml.sax.handler.html#contenthandler-objects">ContentHandler 对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="xml.sax.handler.html#dtdhandler-objects">DTDHandler 对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="xml.sax.handler.html#entityresolver-objects">EntityResolver 对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="xml.sax.handler.html#errorhandler-objects">ErrorHandler 对象</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="xml.sax.utils.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.sax.saxutils</span></code> --- SAX 工具集</a></li>
<li class="toctree-l1"><a class="reference internal" href="xml.sax.reader.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.sax.xmlreader</span></code> --- Interface for XML parsers</a><ul>
<li class="toctree-l2"><a class="reference internal" href="xml.sax.reader.html#xmlreader-objects">XMLReader 对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="xml.sax.reader.html#incrementalparser-objects">IncrementalParser 对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="xml.sax.reader.html#locator-objects">Locator 对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="xml.sax.reader.html#inputsource-objects">InputSource 对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="xml.sax.reader.html#the-attributes-interface">The <code class="xref py py-class docutils literal notranslate"><span class="pre">Attributes</span></code> Interface</a></li>
<li class="toctree-l2"><a class="reference internal" href="xml.sax.reader.html#the-attributesns-interface">The <code class="xref py py-class docutils literal notranslate"><span class="pre">AttributesNS</span></code> Interface</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="pyexpat.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.parsers.expat</span></code> --- Fast XML parsing using Expat</a><ul>
<li class="toctree-l2"><a class="reference internal" href="pyexpat.html#xmlparser-objects">XMLParser对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyexpat.html#expaterror-exceptions">ExpatError Exceptions</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyexpat.html#example">示例</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyexpat.html#module-xml.parsers.expat.model">Content Model Descriptions</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyexpat.html#module-xml.parsers.expat.errors">Expat error constants</a></li>
</ul>
</li>
</ul>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>上一个主题</h4>
  <p class="topless"><a href="uu.html"
                        title="上一章"><code class="xref py py-mod docutils literal notranslate"><span class="pre">uu</span></code> --- 对 uuencode 文件进行编码与解码</a></p>
  <h4>下一个主题</h4>
  <p class="topless"><a href="html.html"
                        title="下一章"><code class="xref py py-mod docutils literal notranslate"><span class="pre">html</span></code> --- 超文本标记语言支持</a></p>
  <div role="note" aria-label="source link">
    <h3>本页</h3>
    <ul class="this-page-menu">
      <li><a href="../bugs.html">提交 Bug</a></li>
      <li>
        <a href="https://github.com/python/cpython/blob/3.7/Doc/library/markup.rst"
            rel="nofollow">显示源代码
        </a>
      </li>
    </ul>
  </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>导航</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="总目录"
             >索引</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python 模块索引"
             >模块</a> |</li>
        <li class="right" >
          <a href="html.html" title="html --- 超文本标记语言支持"
             >下一页</a> |</li>
        <li class="right" >
          <a href="uu.html" title="uu --- 对 uuencode 文件进行编码与解码"
             >上一页</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <a href="../index.html">3.7.8 Documentation</a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >Python 标准库</a> &#187;</li>
    <li class="right">
        

    <div class="inline-search" style="display: none" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="快速搜索" type="text" name="q" />
          <input type="submit" value="转向" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    <script type="text/javascript">$('.inline-search').show(0);</script>
         |
    </li>

      </ul>
    </div>  
    <div class="footer">
    &copy; <a href="../copyright.html">版权所有</a> 2001-2020, Python Software Foundation.
    <br />
    Python 软件基金会是一个非盈利组织。
    <a href="https://www.python.org/psf/donations/">请捐助。</a>
    <br />
    最后更新于 6月 29, 2020.
    <a href="../bugs.html">发现了问题</a>？
    <br />
    使用<a href="http://sphinx.pocoo.org/">Sphinx</a>2.3.1 创建。
    </div>

  </body>
</html>